
Nonterminals object pairs pair value array values.
Terminals '{' '}' ':' '[' ']' ',' number constant string.
Rootsymbol object.

object -> '{' '}': {}.
object -> '{' pairs '}': '$2'.
pairs -> pair: '$1'.
pairs -> pair ',' pairs: list_to_tuple(tuple_to_list('$1') ++ tuple_to_list('$3')).
pair -> string ':' value: {{value_of('$1'), '$3'}}.
value -> array: '$1'.
value -> object: '$1'.
value -> constant: value_of('$1').
value -> number: value_of('$1').
value -> string: value_of('$1').
array -> '[' ']': [].
array -> '[' values ']': '$2'.
values -> value: ['$1'].
values -> value ',' values: ['$1' | '$3'].

Erlang code.
value_of(Token) ->
	erlang:element(3, Token).
